package com.mikao.controller.feedBack;


import com.mikao.dto.bo.ReqDataTableDto;
import com.mikao.dto.bo.ServiceForm;
import com.mikao.dto.vo.RspDataTableDto;
import com.mikao.entity.Service;
import com.mikao.service.ServiceService;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.*;

/**
 * @author kenny
 */
@RestController
@RequestMapping("/management")
@Scope("prototype")
public class ServiceController {

    private ServiceService serviceService;

    public ServiceController(ServiceService serviceService) {
        this.serviceService = serviceService;
    }

    @GetMapping("/serviceList")
    public RspDataTableDto<Service> serviceList(ReqDataTableDto reqDataTableDto) {
        return serviceService.serviceList(reqDataTableDto);
    }

    @PostMapping("/addService")
    public Boolean addService(ServiceForm serviceForm) {
        return serviceService.addService(serviceForm);
    }

    @PostMapping("/deleteService/{id}")
    public void deleteService(@PathVariable Long id) {
        serviceService.deleteService(id);
    }
}
